﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using DBUtility;//请先添加引用
namespace TierApplication
{
    /// <summary>
    /// 类T_OrderInvoice。
    /// </summary>
    [Serializable]
    public partial class T_OrderInvoice
    {
        public T_OrderInvoice()
        { }
        #region Model
        private string _invoiceid;
        private DateTime? _orderdate;
        private string _orderuserid;
        private string _orderid;
        private string _orderno;
        private string _ordertype;
        private string _ordersort;
        private string _orderstatus;
        private string _depotid;
        private string _todepotid;
        private string _audituserid;
        private DateTime? _auditdate;
        private string _auditremark;
        private string _remark;
        private DateTime? _invoicercvdate;
        private string _invoiceno;
        private DateTime? _invoicedate;
        private string _invoiceuserid;
        private string _invoicetitle;
        private string _invoicecontent;
        private decimal? _invoicemoney = 0M;
        private string _invoiceremark;
        private string _invoiceisneed;
        private string _invoiceaudituserid;
        private DateTime? _invoiceauditdate;
        private string _invoiceauditremark;
        private DateTime? _createdate = DateTime.Now;
        private string _createuser;
        private string _remark1;
        private string _remark2;
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceID
        {
            set { _invoiceid = value; }
            get { return _invoiceid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? OrderDate
        {
            set { _orderdate = value; }
            get { return _orderdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderUserID
        {
            set { _orderuserid = value; }
            get { return _orderuserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderID
        {
            set { _orderid = value; }
            get { return _orderid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderNo
        {
            set { _orderno = value; }
            get { return _orderno; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderType
        {
            set { _ordertype = value; }
            get { return _ordertype; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderSort
        {
            set { _ordersort = value; }
            get { return _ordersort; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string OrderStatus
        {
            set { _orderstatus = value; }
            get { return _orderstatus; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string DepotID
        {
            set { _depotid = value; }
            get { return _depotid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string ToDepotID
        {
            set { _todepotid = value; }
            get { return _todepotid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string AuditUserID
        {
            set { _audituserid = value; }
            get { return _audituserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? AuditDate
        {
            set { _auditdate = value; }
            get { return _auditdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string AuditRemark
        {
            set { _auditremark = value; }
            get { return _auditremark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Remark
        {
            set { _remark = value; }
            get { return _remark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? InvoiceRcvDate
        {
            set { _invoicercvdate = value; }
            get { return _invoicercvdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceNo
        {
            set { _invoiceno = value; }
            get { return _invoiceno; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? InvoiceDate
        {
            set { _invoicedate = value; }
            get { return _invoicedate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceUserID
        {
            set { _invoiceuserid = value; }
            get { return _invoiceuserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceTitle
        {
            set { _invoicetitle = value; }
            get { return _invoicetitle; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceContent
        {
            set { _invoicecontent = value; }
            get { return _invoicecontent; }
        }
        /// <summary>
        /// 
        /// </summary>
        public decimal? InvoiceMoney
        {
            set { _invoicemoney = value; }
            get { return _invoicemoney; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceRemark
        {
            set { _invoiceremark = value; }
            get { return _invoiceremark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceIsNeed
        {
            set { _invoiceisneed = value; }
            get { return _invoiceisneed; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceAuditUserID
        {
            set { _invoiceaudituserid = value; }
            get { return _invoiceaudituserid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? InvoiceAuditDate
        {
            set { _invoiceauditdate = value; }
            get { return _invoiceauditdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string InvoiceAuditRemark
        {
            set { _invoiceauditremark = value; }
            get { return _invoiceauditremark; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime? CreateDate
        {
            set { _createdate = value; }
            get { return _createdate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string CreateUser
        {
            set { _createuser = value; }
            get { return _createuser; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Remark1
        {
            set { _remark1 = value; }
            get { return _remark1; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Remark2
        {
            set { _remark2 = value; }
            get { return _remark2; }
        }
        #endregion Model


        #region  Method

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public T_OrderInvoice(string InvoiceID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select InvoiceID,OrderDate,OrderUserID,OrderID,OrderNo,OrderType,OrderSort,OrderStatus,DepotID,ToDepotID,AuditUserID,AuditDate,AuditRemark,Remark,InvoiceRcvDate,InvoiceNo,InvoiceDate,InvoiceUserID,InvoiceTitle,InvoiceContent,InvoiceMoney,InvoiceRemark,InvoiceIsNeed,InvoiceAuditUserID,InvoiceAuditDate,InvoiceAuditRemark,CreateDate,CreateUser,Remark1,Remark2 ");
            strSql.Append(" FROM [T_OrderInvoice] ");
            strSql.Append(" where InvoiceID=@InvoiceID ");
            SqlParameter[] parameters = {
					new SqlParameter("@InvoiceID", SqlDbType.VarChar,-1)};
            parameters[0].Value = InvoiceID;

            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["InvoiceID"] != null)
                {
                    this.InvoiceID = ds.Tables[0].Rows[0]["InvoiceID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderDate"] != null && ds.Tables[0].Rows[0]["OrderDate"].ToString() != "")
                {
                    this.OrderDate = DateTime.Parse(ds.Tables[0].Rows[0]["OrderDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderUserID"] != null)
                {
                    this.OrderUserID = ds.Tables[0].Rows[0]["OrderUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderID"] != null)
                {
                    this.OrderID = ds.Tables[0].Rows[0]["OrderID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderNo"] != null)
                {
                    this.OrderNo = ds.Tables[0].Rows[0]["OrderNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderType"] != null)
                {
                    this.OrderType = ds.Tables[0].Rows[0]["OrderType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderSort"] != null)
                {
                    this.OrderSort = ds.Tables[0].Rows[0]["OrderSort"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderStatus"] != null)
                {
                    this.OrderStatus = ds.Tables[0].Rows[0]["OrderStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["DepotID"] != null)
                {
                    this.DepotID = ds.Tables[0].Rows[0]["DepotID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ToDepotID"] != null)
                {
                    this.ToDepotID = ds.Tables[0].Rows[0]["ToDepotID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditUserID"] != null)
                {
                    this.AuditUserID = ds.Tables[0].Rows[0]["AuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditDate"] != null && ds.Tables[0].Rows[0]["AuditDate"].ToString() != "")
                {
                    this.AuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["AuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AuditRemark"] != null)
                {
                    this.AuditRemark = ds.Tables[0].Rows[0]["AuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null)
                {
                    this.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceRcvDate"] != null && ds.Tables[0].Rows[0]["InvoiceRcvDate"].ToString() != "")
                {
                    this.InvoiceRcvDate = DateTime.Parse(ds.Tables[0].Rows[0]["InvoiceRcvDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvoiceNo"] != null)
                {
                    this.InvoiceNo = ds.Tables[0].Rows[0]["InvoiceNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceDate"] != null && ds.Tables[0].Rows[0]["InvoiceDate"].ToString() != "")
                {
                    this.InvoiceDate = DateTime.Parse(ds.Tables[0].Rows[0]["InvoiceDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvoiceUserID"] != null)
                {
                    this.InvoiceUserID = ds.Tables[0].Rows[0]["InvoiceUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceTitle"] != null)
                {
                    this.InvoiceTitle = ds.Tables[0].Rows[0]["InvoiceTitle"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceContent"] != null)
                {
                    this.InvoiceContent = ds.Tables[0].Rows[0]["InvoiceContent"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceMoney"] != null && ds.Tables[0].Rows[0]["InvoiceMoney"].ToString() != "")
                {
                    this.InvoiceMoney = decimal.Parse(ds.Tables[0].Rows[0]["InvoiceMoney"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvoiceRemark"] != null)
                {
                    this.InvoiceRemark = ds.Tables[0].Rows[0]["InvoiceRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceIsNeed"] != null)
                {
                    this.InvoiceIsNeed = ds.Tables[0].Rows[0]["InvoiceIsNeed"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceAuditUserID"] != null)
                {
                    this.InvoiceAuditUserID = ds.Tables[0].Rows[0]["InvoiceAuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceAuditDate"] != null && ds.Tables[0].Rows[0]["InvoiceAuditDate"].ToString() != "")
                {
                    this.InvoiceAuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["InvoiceAuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvoiceAuditRemark"] != null)
                {
                    this.InvoiceAuditRemark = ds.Tables[0].Rows[0]["InvoiceAuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["CreateDate"] != null && ds.Tables[0].Rows[0]["CreateDate"].ToString() != "")
                {
                    this.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateUser"] != null)
                {
                    this.CreateUser = ds.Tables[0].Rows[0]["CreateUser"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark1"] != null)
                {
                    this.Remark1 = ds.Tables[0].Rows[0]["Remark1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark2"] != null)
                {
                    this.Remark2 = ds.Tables[0].Rows[0]["Remark2"].ToString();
                }
            }
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string InvoiceID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from [T_OrderInvoice]");
            strSql.Append(" where InvoiceID=@InvoiceID ");

            SqlParameter[] parameters = {
					new SqlParameter("@InvoiceID", SqlDbType.VarChar,-1)};
            parameters[0].Value = InvoiceID;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into [T_OrderInvoice] (");
            strSql.Append("InvoiceID,OrderDate,OrderUserID,OrderID,OrderNo,OrderType,OrderSort,OrderStatus,DepotID,ToDepotID,AuditUserID,AuditDate,AuditRemark,Remark,InvoiceRcvDate,InvoiceNo,InvoiceDate,InvoiceUserID,InvoiceTitle,InvoiceContent,InvoiceMoney,InvoiceRemark,InvoiceIsNeed,InvoiceAuditUserID,InvoiceAuditDate,InvoiceAuditRemark,CreateDate,CreateUser,Remark1,Remark2)");
            strSql.Append(" values (");
            strSql.Append("@InvoiceID,@OrderDate,@OrderUserID,@OrderID,@OrderNo,@OrderType,@OrderSort,@OrderStatus,@DepotID,@ToDepotID,@AuditUserID,@AuditDate,@AuditRemark,@Remark,@InvoiceRcvDate,@InvoiceNo,@InvoiceDate,@InvoiceUserID,@InvoiceTitle,@InvoiceContent,@InvoiceMoney,@InvoiceRemark,@InvoiceIsNeed,@InvoiceAuditUserID,@InvoiceAuditDate,@InvoiceAuditRemark,@CreateDate,@CreateUser,@Remark1,@Remark2)");
            SqlParameter[] parameters = {
					new SqlParameter("@InvoiceID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderDate", SqlDbType.DateTime),
					new SqlParameter("@OrderUserID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderNo", SqlDbType.VarChar,50),
					new SqlParameter("@OrderType", SqlDbType.VarChar,10),
					new SqlParameter("@OrderSort", SqlDbType.VarChar,10),
					new SqlParameter("@OrderStatus", SqlDbType.VarChar,10),
					new SqlParameter("@DepotID", SqlDbType.VarChar,10),
					new SqlParameter("@ToDepotID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditUserID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditDate", SqlDbType.DateTime),
					new SqlParameter("@AuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@Remark", SqlDbType.VarChar,200),
					new SqlParameter("@InvoiceRcvDate", SqlDbType.DateTime),
					new SqlParameter("@InvoiceNo", SqlDbType.VarChar,100),
					new SqlParameter("@InvoiceDate", SqlDbType.DateTime),
					new SqlParameter("@InvoiceUserID", SqlDbType.VarChar,50),
					new SqlParameter("@InvoiceTitle", SqlDbType.VarChar,100),
					new SqlParameter("@InvoiceContent", SqlDbType.VarChar,250),
					new SqlParameter("@InvoiceMoney", SqlDbType.Decimal,9),
					new SqlParameter("@InvoiceRemark", SqlDbType.VarChar,250),
					new SqlParameter("@InvoiceIsNeed", SqlDbType.VarChar,1),
					new SqlParameter("@InvoiceAuditUserID", SqlDbType.VarChar,50),
					new SqlParameter("@InvoiceAuditDate", SqlDbType.DateTime),
					new SqlParameter("@InvoiceAuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@CreateDate", SqlDbType.DateTime),
					new SqlParameter("@CreateUser", SqlDbType.VarChar,20),
					new SqlParameter("@Remark1", SqlDbType.VarChar,50),
					new SqlParameter("@Remark2", SqlDbType.VarChar,50)};
            parameters[0].Value = InvoiceID;
            parameters[1].Value = OrderDate;
            parameters[2].Value = OrderUserID;
            parameters[3].Value = OrderID;
            parameters[4].Value = OrderNo;
            parameters[5].Value = OrderType;
            parameters[6].Value = OrderSort;
            parameters[7].Value = OrderStatus;
            parameters[8].Value = DepotID;
            parameters[9].Value = ToDepotID;
            parameters[10].Value = AuditUserID;
            parameters[11].Value = AuditDate;
            parameters[12].Value = AuditRemark;
            parameters[13].Value = Remark;
            parameters[14].Value = InvoiceRcvDate;
            parameters[15].Value = InvoiceNo;
            parameters[16].Value = InvoiceDate;
            parameters[17].Value = InvoiceUserID;
            parameters[18].Value = InvoiceTitle;
            parameters[19].Value = InvoiceContent;
            parameters[20].Value = InvoiceMoney;
            parameters[21].Value = InvoiceRemark;
            parameters[22].Value = InvoiceIsNeed;
            parameters[23].Value = InvoiceAuditUserID;
            parameters[24].Value = InvoiceAuditDate;
            parameters[25].Value = InvoiceAuditRemark;
            parameters[26].Value = CreateDate;
            parameters[27].Value = CreateUser;
            parameters[28].Value = Remark1;
            parameters[29].Value = Remark2;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update [T_OrderInvoice] set ");
            strSql.Append("OrderDate=@OrderDate,");
            strSql.Append("OrderUserID=@OrderUserID,");
            strSql.Append("OrderID=@OrderID,");
            strSql.Append("OrderNo=@OrderNo,");
            strSql.Append("OrderType=@OrderType,");
            strSql.Append("OrderSort=@OrderSort,");
            strSql.Append("OrderStatus=@OrderStatus,");
            strSql.Append("DepotID=@DepotID,");
            strSql.Append("ToDepotID=@ToDepotID,");
            strSql.Append("AuditUserID=@AuditUserID,");
            strSql.Append("AuditDate=@AuditDate,");
            strSql.Append("AuditRemark=@AuditRemark,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("InvoiceRcvDate=@InvoiceRcvDate,");
            strSql.Append("InvoiceNo=@InvoiceNo,");
            strSql.Append("InvoiceDate=@InvoiceDate,");
            strSql.Append("InvoiceUserID=@InvoiceUserID,");
            strSql.Append("InvoiceTitle=@InvoiceTitle,");
            strSql.Append("InvoiceContent=@InvoiceContent,");
            strSql.Append("InvoiceMoney=@InvoiceMoney,");
            strSql.Append("InvoiceRemark=@InvoiceRemark,");
            strSql.Append("InvoiceIsNeed=@InvoiceIsNeed,");
            strSql.Append("InvoiceAuditUserID=@InvoiceAuditUserID,");
            strSql.Append("InvoiceAuditDate=@InvoiceAuditDate,");
            strSql.Append("InvoiceAuditRemark=@InvoiceAuditRemark,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("CreateUser=@CreateUser,");
            strSql.Append("Remark1=@Remark1,");
            strSql.Append("Remark2=@Remark2");
            strSql.Append(" where InvoiceID=@InvoiceID ");
            SqlParameter[] parameters = {
					new SqlParameter("@OrderDate", SqlDbType.DateTime),
					new SqlParameter("@OrderUserID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderID", SqlDbType.VarChar,10),
					new SqlParameter("@OrderNo", SqlDbType.VarChar,50),
					new SqlParameter("@OrderType", SqlDbType.VarChar,10),
					new SqlParameter("@OrderSort", SqlDbType.VarChar,10),
					new SqlParameter("@OrderStatus", SqlDbType.VarChar,10),
					new SqlParameter("@DepotID", SqlDbType.VarChar,10),
					new SqlParameter("@ToDepotID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditUserID", SqlDbType.VarChar,10),
					new SqlParameter("@AuditDate", SqlDbType.DateTime),
					new SqlParameter("@AuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@Remark", SqlDbType.VarChar,200),
					new SqlParameter("@InvoiceRcvDate", SqlDbType.DateTime),
					new SqlParameter("@InvoiceNo", SqlDbType.VarChar,100),
					new SqlParameter("@InvoiceDate", SqlDbType.DateTime),
					new SqlParameter("@InvoiceUserID", SqlDbType.VarChar,50),
					new SqlParameter("@InvoiceTitle", SqlDbType.VarChar,100),
					new SqlParameter("@InvoiceContent", SqlDbType.VarChar,250),
					new SqlParameter("@InvoiceMoney", SqlDbType.Decimal,9),
					new SqlParameter("@InvoiceRemark", SqlDbType.VarChar,250),
					new SqlParameter("@InvoiceIsNeed", SqlDbType.VarChar,1),
					new SqlParameter("@InvoiceAuditUserID", SqlDbType.VarChar,50),
					new SqlParameter("@InvoiceAuditDate", SqlDbType.DateTime),
					new SqlParameter("@InvoiceAuditRemark", SqlDbType.VarChar,250),
					new SqlParameter("@CreateDate", SqlDbType.DateTime),
					new SqlParameter("@CreateUser", SqlDbType.VarChar,20),
					new SqlParameter("@Remark1", SqlDbType.VarChar,50),
					new SqlParameter("@Remark2", SqlDbType.VarChar,50),
					new SqlParameter("@InvoiceID", SqlDbType.VarChar,10)};
            parameters[0].Value = OrderDate;
            parameters[1].Value = OrderUserID;
            parameters[2].Value = OrderID;
            parameters[3].Value = OrderNo;
            parameters[4].Value = OrderType;
            parameters[5].Value = OrderSort;
            parameters[6].Value = OrderStatus;
            parameters[7].Value = DepotID;
            parameters[8].Value = ToDepotID;
            parameters[9].Value = AuditUserID;
            parameters[10].Value = AuditDate;
            parameters[11].Value = AuditRemark;
            parameters[12].Value = Remark;
            parameters[13].Value = InvoiceRcvDate;
            parameters[14].Value = InvoiceNo;
            parameters[15].Value = InvoiceDate;
            parameters[16].Value = InvoiceUserID;
            parameters[17].Value = InvoiceTitle;
            parameters[18].Value = InvoiceContent;
            parameters[19].Value = InvoiceMoney;
            parameters[20].Value = InvoiceRemark;
            parameters[21].Value = InvoiceIsNeed;
            parameters[22].Value = InvoiceAuditUserID;
            parameters[23].Value = InvoiceAuditDate;
            parameters[24].Value = InvoiceAuditRemark;
            parameters[25].Value = CreateDate;
            parameters[26].Value = CreateUser;
            parameters[27].Value = Remark1;
            parameters[28].Value = Remark2;
            parameters[29].Value = InvoiceID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string InvoiceID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from [T_OrderInvoice] ");
            strSql.Append(" where InvoiceID=@InvoiceID ");
            SqlParameter[] parameters = {
					new SqlParameter("@InvoiceID", SqlDbType.VarChar,-1)};
            parameters[0].Value = InvoiceID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public void GetModel(string InvoiceID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select InvoiceID,OrderDate,OrderUserID,OrderID,OrderNo,OrderType,OrderSort,OrderStatus,DepotID,ToDepotID,AuditUserID,AuditDate,AuditRemark,Remark,InvoiceRcvDate,InvoiceNo,InvoiceDate,InvoiceUserID,InvoiceTitle,InvoiceContent,InvoiceMoney,InvoiceRemark,InvoiceIsNeed,InvoiceAuditUserID,InvoiceAuditDate,InvoiceAuditRemark,CreateDate,CreateUser,Remark1,Remark2 ");
            strSql.Append(" FROM [T_OrderInvoice] ");
            strSql.Append(" where InvoiceID=@InvoiceID ");
            SqlParameter[] parameters = {
					new SqlParameter("@InvoiceID", SqlDbType.VarChar,-1)};
            parameters[0].Value = InvoiceID;

            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["InvoiceID"] != null)
                {
                    this.InvoiceID = ds.Tables[0].Rows[0]["InvoiceID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderDate"] != null && ds.Tables[0].Rows[0]["OrderDate"].ToString() != "")
                {
                    this.OrderDate = DateTime.Parse(ds.Tables[0].Rows[0]["OrderDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderUserID"] != null)
                {
                    this.OrderUserID = ds.Tables[0].Rows[0]["OrderUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderID"] != null)
                {
                    this.OrderID = ds.Tables[0].Rows[0]["OrderID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderNo"] != null)
                {
                    this.OrderNo = ds.Tables[0].Rows[0]["OrderNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderType"] != null)
                {
                    this.OrderType = ds.Tables[0].Rows[0]["OrderType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderSort"] != null)
                {
                    this.OrderSort = ds.Tables[0].Rows[0]["OrderSort"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OrderStatus"] != null)
                {
                    this.OrderStatus = ds.Tables[0].Rows[0]["OrderStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["DepotID"] != null)
                {
                    this.DepotID = ds.Tables[0].Rows[0]["DepotID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ToDepotID"] != null)
                {
                    this.ToDepotID = ds.Tables[0].Rows[0]["ToDepotID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditUserID"] != null)
                {
                    this.AuditUserID = ds.Tables[0].Rows[0]["AuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AuditDate"] != null && ds.Tables[0].Rows[0]["AuditDate"].ToString() != "")
                {
                    this.AuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["AuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AuditRemark"] != null)
                {
                    this.AuditRemark = ds.Tables[0].Rows[0]["AuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null)
                {
                    this.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceRcvDate"] != null && ds.Tables[0].Rows[0]["InvoiceRcvDate"].ToString() != "")
                {
                    this.InvoiceRcvDate = DateTime.Parse(ds.Tables[0].Rows[0]["InvoiceRcvDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvoiceNo"] != null)
                {
                    this.InvoiceNo = ds.Tables[0].Rows[0]["InvoiceNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceDate"] != null && ds.Tables[0].Rows[0]["InvoiceDate"].ToString() != "")
                {
                    this.InvoiceDate = DateTime.Parse(ds.Tables[0].Rows[0]["InvoiceDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvoiceUserID"] != null)
                {
                    this.InvoiceUserID = ds.Tables[0].Rows[0]["InvoiceUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceTitle"] != null)
                {
                    this.InvoiceTitle = ds.Tables[0].Rows[0]["InvoiceTitle"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceContent"] != null)
                {
                    this.InvoiceContent = ds.Tables[0].Rows[0]["InvoiceContent"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceMoney"] != null && ds.Tables[0].Rows[0]["InvoiceMoney"].ToString() != "")
                {
                    this.InvoiceMoney = decimal.Parse(ds.Tables[0].Rows[0]["InvoiceMoney"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvoiceRemark"] != null)
                {
                    this.InvoiceRemark = ds.Tables[0].Rows[0]["InvoiceRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceIsNeed"] != null)
                {
                    this.InvoiceIsNeed = ds.Tables[0].Rows[0]["InvoiceIsNeed"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceAuditUserID"] != null)
                {
                    this.InvoiceAuditUserID = ds.Tables[0].Rows[0]["InvoiceAuditUserID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InvoiceAuditDate"] != null && ds.Tables[0].Rows[0]["InvoiceAuditDate"].ToString() != "")
                {
                    this.InvoiceAuditDate = DateTime.Parse(ds.Tables[0].Rows[0]["InvoiceAuditDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvoiceAuditRemark"] != null)
                {
                    this.InvoiceAuditRemark = ds.Tables[0].Rows[0]["InvoiceAuditRemark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["CreateDate"] != null && ds.Tables[0].Rows[0]["CreateDate"].ToString() != "")
                {
                    this.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateUser"] != null)
                {
                    this.CreateUser = ds.Tables[0].Rows[0]["CreateUser"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark1"] != null)
                {
                    this.Remark1 = ds.Tables[0].Rows[0]["Remark1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark2"] != null)
                {
                    this.Remark2 = ds.Tables[0].Rows[0]["Remark2"].ToString();
                }
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM [T_OrderInvoice] ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        #endregion  Method
    }
}

